<template>
  <MyTable :loading="queryloading" :data="list" :cols="cols">
    <template v-slot:level="{row:{level}}">
        <el-tag :type="colors[level]">
           {{levels[level]}}级
        </el-tag>
         </template>
  </MyTable>
</template>

<script>
import { getRightList } from "../../api/rights.js";
export default {
  name: "Right",
  data() {
    return {
        /**
         * 等级
         */
        levels:["一","二","三"],
      /**
       * 列
       */
      cols: [
        { title: "#", type: "index" },
        { title: "权限名称", name: "authName" },
        { title: "路径", name: "path" },
        { title: "权限等级", name: "level",slot:"level"},
      ],
      /**
       * 颜色
       */
      colors:["","success","warning"]

    };
  },

  mounted() {},
  methods: {
    async getRights() {
      try {
        this.queryloading = true;
        this.list = await getRightList();
      } catch (error) {}
      this.queryloading = false;
    },
  },
  created() {
    this.getRights();
  },
};
</script>

<style scoped></style>
